import { resolve } from 'path';
import { defineConfig } from 'electron-vite';
import vue from '@vitejs/plugin-vue';

export default defineConfig({
  main: {
    build: {
      rollupOptions: {
        external: ['@electron-toolkit/utils'],
      },
    },
  },
  preload: {
    build: {
      rollupOptions: {
        external: ['@electron-toolkit/preload'],
        input: {
          index: resolve(__dirname, 'src/preload/index.ts'),
          view: resolve(__dirname, 'src/preload/view.ts'),
        },
      },
    },
  },
  renderer: {
    resolve: {
      alias: {
        '@renderer': resolve('src/renderer/src'),
      },
    },
    plugins: [vue()],
    build: {
      rollupOptions: {
        input: {
          index: resolve(__dirname, 'src/renderer/index.html'),
          view: resolve(__dirname, 'src/renderer/view.html'),
        },
      },
    },
  },
});
